package org.jdemo.nosql.zookeeper;

import org.apache.curator.RetryPolicy;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.retry.ExponentialBackoffRetry;
import org.jdemo.util.PropertiesResource;

/**
 * org.jdemo.nosql.zookeeper.ZKController
 *
 * @author longlin(longlin@cyou-inc.com)
 * @date 2014/9/17
 * @since V1.0
 */
public class ZKController {
    public static void main(String[] args) throws Exception {
        String zkHost = new PropertiesResource("/zk.properties").getString("zk.host");

        RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
        CuratorFramework client = CuratorFrameworkFactory.newClient(zkHost, retryPolicy);
        client.start();

//        client.create().forPath("/abc1", "abc".getBytes());
//        client.setData().forPath("/abc1", "1".getBytes());
        client.delete().forPath("/abc1");
    }
}
